<?
include('inc/addondb.php');
$site5 = mysql_fetch_object(mysql_query("SELECT * FROM `settings` WHERE `maintenance`='0'"));
$site3 = mysql_fetch_object(mysql_query("SELECT * FROM `youtubelikes` WHERE `id`='{$_GET['him']}'"));
$count = @file_get_contents(($site5->site_url) . '/youtubelikescount.php?id=' . ($site3->youtube));
$count1 = trim($count);
$count0 = $_GET['count'];
if(isset($_GET['me'])){

if ($count1 > $count0){
$plused1 = mysql_query("SELECT * FROM `youtubeliked` WHERE `site_id`='{$_GET['him']}' AND `user_id`='{$_GET['me']}'");
$plused  = mysql_num_rows($plused1);
if ($plused == 0){

mysql_query("UPDATE `youtubelikes` SET `views`=`views`+'1' WHERE `id`='{$_GET['him']}'");
mysql_query("UPDATE `youtubelikes` SET `points`=`points`-'{$site3->cpc}' WHERE `id`='{$_GET['him']}'");
mysql_query("UPDATE `users` set `coins`=`coins`+'{$site3->cpc}' WHERE `id`='{$_GET['me']}'");
mysql_query("INSERT INTO `youtubeliked` (user_id, site_id) VALUES('{$_GET['me']}', '{$_GET['him']}')");



echo "SUCCESS: You Liked a Video! You got {$site3->cpc} Coins!";
} else {
echo "ERROR: You already Liked this Video!";
}} else {
echo "ERROR: Youtube says you did not Like that Video! Please refresh the page and try again.";
}}
?>